package config

import (
	"server/share/protoc"

	"github.com/hwcer/yyds"
)

const (
	MonthSignDayCountRewardName = "MonthSignDayCountReward"
)

func init() {
	yyds.Config.Register(&monthSignDayCountRewardHandle{})
}

type monthSignDayCountReward struct {
	dict map[int32]map[int32]*protoc.MonthSignDayCountReward
}

func GetMonthSignDayCountReward(month int32) map[int32]*protoc.MonthSignDayCountReward {
	h := yyds.Config.Process.Get(MonthSignDayCountRewardName).(*monthSignDayCountReward)
	return h.dict[month]
}

type monthSignDayCountRewardHandle struct {
	HandleDefault
}

func (this *monthSignDayCountRewardHandle) Handle(c *yyds.CS, i any) {
	data := i.(*output)
	g := &monthSignDayCountReward{}
	g.dict = make(map[int32]map[int32]*protoc.MonthSignDayCountReward)
	//月签到今日运势
	for _, d := range data.MonthSignDayCountReward {
		m := d.Month
		if g.dict[m] == nil {
			g.dict[m] = make(map[int32]*protoc.MonthSignDayCountReward)
		}
		g.dict[m][d.Id] = d
	}

	c.Process.Set(MonthSignDayCountRewardName, g)

}
